﻿using log4net;
using NpgsqlTypes;
using PcaCore.BOL.Pca;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace PcaCore.DAL.Pca
{
    public class dConfiguracion
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(dConfiguracion));

        #region Public

        public static oConfiguracion Get(string oficinaId,
                                         string empresaId,
                                         string configuracionId)
        {
            try
            {
                //CREATE OR REPLACE FUNCTION pca.fn_get_configuracion(varchar,--empresa_id $1
                //            varchar,--oficina_id $2
                //            text --configuracion_id $3
                //            )RETURNS SETOF pca.configuraciones
                return Core.GetObjectDb<oConfiguracion>("pca.fn_get_configuracion",
                                                        new oParametro(NpgsqlDbType.Varchar, empresaId), 
                                                        new oParametro(NpgsqlDbType.Varchar, oficinaId),
                                                        new oParametro(NpgsqlDbType.Text, configuracionId));
            }
            catch (Exception ex)
            {
                throw Core.LogException(log, ex, MethodBase.GetCurrentMethod().Name);
            }
        }

        #endregion
    }
}
